#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const* argv[])
{
    char c = 'c';

    FILE *f = fopen("file1", "r+");
    if (f == NULL)
    {
        perror("fopen error");
        exit(1);
    }

    if (fwrite(&c, 1, 1, f) < 0)
    {
        perror("fwrite error");
        exit(1);
    }

    if (fread(&c, 1, 1, f) < 0)
    {
        perror("fread error");
        exit(1);
    }

    printf("%c\n", c);

    return 0;
}
